library(tidyverse)
library(wbstats)
library(plotly)
library(readxl)
library(knitr)
library(kableExtra)

1 Gross Domestic Product (GDP)

We can initially approach the concept of GDP by explaining the terms “Product”, “Domestic” and “Gross” separately (Lequiller and Blades 2014, Chapter 1):

1.1 Data about GDP using Colombia as an example

Initially the units in which GDP is measure is in monetary units of a specific currency, \(c\). Therefore \(GDP_{s}^{c}(t)\) means the \(GDP\) of territory \(s\) in a given period \(t\). To make the discussion less abstract we present a plot of \(GDP\) for Colombia, \(s = COL\), expressed in Colombian pesos, \(c = COP\), for the years 1960 to 2019, \(t = 1960, \ldots, 2019\):

# Clean data
gdp_col <- wbstats::wb(country   = "COL",
                             indicator = "NY.GDP.MKTP.CN",
                             startdate = 1960,
                             enddate   = 2019) %>%
    tibble::as_tibble() %>%
    dplyr::select(date, value) %>%
    dplyr::mutate(date       = as.double(date),
                  label_text = stringr::str_glue('Year: {date}
                                                  GDP: {value %>% scales::dollar()}'))

# Plot
static_plot1 <- gdp_col %>%
    # Data
    ggplot2::ggplot(aes(x = date, y =value)) +
    # Geoms
    ggplot2::geom_point(aes(text = label_text),
                        shape = 21,
                        color = "black",
                        fill  = "red") +
    ggplot2::geom_line(linetype = "dashed") +
    # Scales
    ggplot2::scale_x_continuous(breaks = c(1960:2019)) +
    ggplot2::scale_y_continuous(breaks = seq(from = 0, to = 1.10e15, by = 1e14),
                                labels = scales::number_format(scale = 1/1e12, suffix = "B")) +
    ggplot2::labs(x = "Year",
                  y = "GDP in current local currency [B = Billion in long scale (10^12)]",
                  title = "GDP of Colombia: 1960-2019") +
    # Themes
    ggplot2::theme(panel.border      = element_rect(fill = NA, color = "black"),
                   plot.background   = element_rect(fill = "#f3fcfc"),
                   panel.background  = element_rect(fill = "#f3f7fc"),
                   legend.background = element_rect(fill = "#f3fcfc"),
                   plot.title        = element_text(face = "bold"),
                   axis.text.x       = element_text(angle = -90, vjust = 0.5),
                   axis.title        = element_text(face = "bold"),
                   legend.title      = element_text(face = "bold"),
                   axis.text         = element_text(face = "bold"))

    # Interactivity
    static_plot1 %>%
      plotly::ggplotly(tooltip = "text")

1.2 A simple economy to explain the measurement of production (Blanchard 2017)

  • In a certain geographical territory \(s\) and in a given period \(t\) there exist \(2\) profit-making enterprises:

    • Steel enterprise

    • Car enterprise

      • The Steel enterprise sells to the Car enterprise steel. Then the Car enterprise uses steel to produce cars an sell them to households located inside or outside the geographical territory \(s\)

      • In that sense the economy uses steel, machinery and labor, known as inputs of production in the field of economics , to produce a final good represented by cars where the production is divided between the owners of the \(2\) enterprises who perceive an income represented by profits and the workers who perceive an income represented by wages.

  • In this simple economy we do not have non-profit institutions and a government that imposes taxes to offer services and goods like public education in \(t\) because the only goods produced are steel and cars.

  • We also assume that production doesn’t accumulate in \(t\). Therefore steel is used entirely to produce cars and all the cars are consumed by households located inside or outside the geographical territory \(s\). Thus, the profit-making enterprises don’t accumulate inventories and distribute all the profits to the owners of the \(2\) enterprises in \(t\).

  • Finally we assume that households inside the geographical territory \(s\) only consume cars produced inside the geographical territory \(s\) and not cars produced outside the geographical territory \(s\) in \(t\). Also, the \(2\) profit-making enterprises don’t buy machines produce outside the geographical territory \(s\) to produce steel or cars in \(t\).

  • We can have a more realistic economy that have:

    • Profit-making enterprises that acummulate inventories or don’t distribute all the profits to the owners

    • Profit-making enterprises that not only produce but pollute the air or the environment

    • Non-profit institutions that by law are requiere not to distribute profits

    • Households located inside or outside the geographical territory \(s\) that save part of their income and don’t consume everything or that engage in illegal activities like robberies

    • Households inside the geographical territory \(s\) that have children and require and education system

    • Households inside the geographical territory \(s\) that consume goods and services produced outside the geographical territory \(s\)

    • A government that imposes taxes to offer services like justice and goods like public education and deliver subsidies

And many other aspects not included in this short list but the idea is to explain in a simple way the measurement of GDP.

  • The above simple economy in a certain geographical territory \(s\) and in a given period \(t\) can be represented in the following way using specific values to be less abstract and expressing every item in specific currency, \(c\), like Colombia pesos (COP):

    • Steel enterprise

      • Steel sales to Car enterprise: \(100 \text{ COP}\)

      • Expenses:

        • Wages: \(80 \text{ COP}\)
      • Profits: \(20 \text{ COP}\)

    • Car enterprise

      • Revenue from sales of cars: \(200 \text{ COP}\)

      • Expenses:

        • Wages: \(70\) COP

        • Steel purchases to Steel enterprise: \(100\) COP

      • Profits: \(30\) COP

1.2.1 Measuring production and the double counting problem

  • If you add in monetary terms the production of both companies you get a total of: Production Steel enterprise \(+\) Production Car enterprise \(=\) Steel sales to Car enterprise \(+\) Revenue from sales of cars \(= 100 \text{ COP} + 200 \text{ COP} = 300 \text{ COP}\)

  • If the production of the Steel enterprise and the Car enterprise is added, the value of steel is being added two times.

  • It is necessary to eliminate at some stage of the production process the value of steel in our example

1.2.2 Three equivalent ways to measure production and avoid the double counting problem

1.2.2.1 GDP as the sum of value added

  • GDP is the sum of value added in a certain geographical territory \(s\) during a given period \(t\) expressed in a local currency \(c\).

  • In the field of economics the value added is the value that is added at each stage of production. It is defined as the difference between the Production in expressed in a Monetary Terms (PMT) and the Consumption of Intermediate Goods (CIG).

    • The PMT is simply the production expressed using a local currency \(c\)

    • The CIG is the monetary value expressed using a local currency \(c\) of inputs that are completely transformed and depleted in the production process and that are used to produce other products.

      • Example of inputs that are not part of the CIG:

        • Wages paid by a profit-making enterprise to its workers: labor can be used for several periods and although its value is affected in the periods close to the age of retirement of individuals, is not fully consumed in the production process.

        • Assets that belong to a profit-making enterprise and depreciation (consumption of fixed capital): assets are durable goods that can be used for several periods and although their value is affected by physical deterioration, foreseeable wear and accidental damage it is important to remember that depreciation (consumption of fixed capital) is included and not deducted in the measurement of GDP.

  • Measuring GDP as the sum of value added using our simple economy:

    • Steel enterprise

      • PMT: \(100 \text{ COP}\)

      • CIG: \(0 \text{ COP}\) (Wages are not part of CIG)

      • Value added: \(100 \text{ COP} - 0 \text{ COP } = 100 \text{ COP}\)

    • Car enterprise

      • PMT: \(200 \text{ COP}\)

      • CIG: \(100 \text{ COP}\) (Wages are not part of CIG)

      • Value added: \(200 \text{ COP} - 100 \text{ COP } = 100 \text{ COP}\)

    • GDP

      • Total Value Added = Value added Steel enterprise \(+\) Value added Car enterprise \(= 100 \text{ COP} + 100 \text{ COP} = 200 \text{ COP} =\) GDP

1.2.2.2 GDP as the sum of incomes

  • GDP is the sum of the incomes perceived by individuals in a certain geographical territory \(s\) during a given period \(t\) expressed in a local currency \(c\).

  • In that sense the GDP can me measure as the sum of the different incomes that individuals perceive like profits and wages

  • Measuring GDP as the sum of incomes using our simple economy:

    • Steel enterprise

      • Workers income: \(80 \text{ COP}\)

      • Owners income: \(20 \text{ COP}\)

    • Car enterprise

      • Workers income: \(70 \text{ COP}\)

      • Owners income: \(30 \text{ COP}\)

    • GDP

      • Total Income = Total workers income \(+\) Total owners income \(= (80 \text{ COP} + 20 \text{ COP}) + (20 \text{ COP} + 30 \text{ COP}) = 200 \text{ COP} =\) GDP

1.2.2.3 GDP as the value and uses of final goods and services

  • GDP is the value of all the final goods and services produced in a certain geographical territory \(s\) during a given period \(t\) expressed in a local currency \(c\) and classified according to their use.

  • We can classify the uses of final production in the following items which corresponds only to goods and services produced inside a certain geographical territory \(s\) during a given period \(t\) expressed in a local currency \(c\):

    • Households and non-profit institutions final consumption expenditure: \(C_s^c(t)\)

      • It simply indicates that part of the production is consumed by households which includes the expenditures of nonprofit institutions serving households.

        • There is an exception where purchases of dwellings by households are excluded from \(C_s^c(t)\)
    • Gross capital formation: \(I_s^c(t)\)

      • It simply refers to additions of fixed assets to the economy plus net changes in the level of inventories.

        • In this item purchases of dwellings by households are included becauses dwellings are considered additions of fixed assets to the economy.

        • Inventories refers to stocks of goods held by enterprises to meet temporary or unexpected fluctuations in production or sales and work in progress (in our simple economy “work in progress” will be for example the case of a car that it is not totally finished by Car enterprise at the end of period \(t\)).

    • General government final consumption expenditure: \(G_s^c(t)\)

      • It simply refers to most of the government’s current expenses for purchases of goods and services.
    • Exports of goods and services: \(X_s^c(t)\)

      • It simply refers to all goods and services provided to the rest of the world that is outside \(s\).
  • In that sense \(GDP_s^c(t) = C_s^c(t) + I_s^c(t) + G_s^c(t) + X_s^c(t)\)

  • Measuring GDP as the as the value and uses of final goods and services:

    • \(C_s^c(t) + X_s^c(t) = 200 \text{ COP}\) (It corresponds to the Revenue from sales of cars that are consumed by households or exported)

    • \(I_s^c(t) = 0 \text{ COP}\)

    • \(G_s^c(t) = 0 \text{ COP}\)

    • \(GDP_s^c(t) = 200 \text{ COP} + 0 \text{ COP} + 0 \text{ COP} = 200 \text{ COP}\)

1.2.2.3.1 The macroeconomic identity
  • In all the macroeconomic textbooks and data published by statistical organizations it is pointed out that \(GDP = C + I + G + X - IM\) where \(IM\) refers to the imports received from the rest of the world in relation to a certain geographical territory \(s\).

  • This is consistent with \(GDP_s^c(t) = C_s^c(t) + I_s^c(t) + G_s^c(t) + X_s^c(t)\) if we rewrite this expression as:

\[\begin{split} GDP_s^c(t) & = C_s^c(t) + I_s^c(t) + G_s^c(t) + X_s^c(t) \\ & = C_s^c(t) + C_{rw}^c(t) + I_s^c(t) + I_{rw}^c(t) + G_s^c(t) + G_{rw}^c(t) + X_s^c(t) - C_{rw}^c(t) - I_{rw}^c(t) - G_{rw}^c(t) \\ & = C_s^c(t) + C_{rw}^c(t) + I_s^c(t) + I_{rw}^c(t) + G_s^c(t) + G_{rw}^c(t) + X_s^c(t) - (C_{rw}^c(t) + I_{rw}^c(t) + G_{rw}^c(t)) \\ & = C^c(t) + I^c(t) + G^c(t) + X^c(t) - IM^c(t) \end{split}\]

  • Where:

    • \(C_{rw}^c(t)\) is the Households and non-profit institutions final consumption expenditure with goods and services produced in the rest of the world, \(rw\).

    • \(C^c(t) = C_s^c(t) + C_{rw}^c(t)\) is the _ Total Households and non-profit institutions final consumption expenditure__

    • \(I_{rw}^c(t)\) is the Gross capital formation with goods and services produced in the rest of the world, \(rw\).

    • \(I^c(t) = I_s^c(t) + I_{rw}^c(t)\) is the Total Gross capital formation

    • \(G_{rw}^c(t)\) is the General government final consumption expenditure with goods and services produced in the rest of the world, \(rw\).

    • \(G^c(t) = G_s^c(t) + G_{rw}^c(t)\) is the Total General government final consumption expenditure

    • \(IM^c(t) = C_{rw}^c(t) + I_{rw}^c(t) + G_{rw}^c(t)\)

1.3 From a simple economy with artificial data to real data

Using data with annual periodicity provided by the Departamento Nacional de Estadística (DANE) from Colombia expressed in Colombian Pesos (COP) for the years \(2005-2019\) we show the behavior of the GDP using the three equivalent ways to measure production

1.3.1 GDP as the sum of value added for Colombia using the ISIC1

  • In our simple economy there was no government. In the case of the data presented GDP is equal to the sum of value added plus taxes minus subsidies on goods an services produced.

  • In our simple economy there were only \(2\) profit-making enterprises. In the case of the data presented the sum of value added is presented for \(12\) sectors plus taxes minus subsidies on goods an services produced by these \(12\) sectors.

1.3.1.1 Sectors considered

readxl::read_excel(path  = "anual_national_accounts_col_2005_2019.xlsx", 
                   sheet = 2, 
                   range = "B11:E108") %>% 
    dplyr::select(-c(2:3)) %>%
    tidyr::drop_na() %>% 
    purrr::set_names(nm = c("ID", "Sector")) %>% 
    knitr::kable() %>%
    kableExtra::kable_styling(bootstrap_options = c("striped", "bordered")) %>% 
    kableExtra::column_spec(column = 1, width = "2.5cm")
ID Sector
A Agricultura, ganadería, caza, silvicultura y pesca
B Explotación de minas y canteras
C Industrias manufactureras
D + E Suministro de electricidad, gas, vapor y aire acondicionado; Distribución de agua; evacuación y tratamiento de aguas residuales, gestión de desechos y actividades de saneamiento ambiental
F Construcción
G + H + I Comercio al por mayor y al por menor; reparación de vehículos automotores y motocicletas; Transporte y almacenamiento; Alojamiento y servicios de comida
J Información y comunicaciones
K Actividades financieras y de seguros
L Actividades inmobiliarias
M + N Actividades profesionales, científicas y técnicas; Actividades de servicios administrativos y de apoyo
O + P + Q Administración pública y defensa; planes de seguridad social de afiliación obligatoria; Educación; Actividades de atención de la salud humana y de servicios sociales
R + S + T Actividades artísticas, de entretenimiento y recreación y otras actividades de servicios; Actividades de los hogares individuales en calidad de empleadores; actividades no diferenciadas de los hogares individuales como productores de bienes y servicios para uso propio

1.4 Participacion of taxes minus subsidies and value added by sectors in the GDP

# Clean data
gdp_col_value_added <- readxl::read_excel(path  = "anual_national_accounts_col_2005_2019.xlsx", 
                                          sheet = 2, 
                                          range = "B11:T108") %>% 
    dplyr::select(-c(2:4)) %>%
    tidyr::drop_na() %>%
    purrr::set_names(nm = c("ID", 2005:2019)) %>% 
    dplyr::bind_rows(readxl::read_excel(path      = "anual_national_accounts_col_2005_2019.xlsx", 
                                        sheet     = 2, 
                                        range     = "B114:T114", 
                                        col_names = FALSE) %>% 
                         dplyr::select(-c(1:3)) %>%
                         purrr::set_names(nm = c("ID", 2005:2019)) %>% 
                         dplyr::mutate(ID = ID %>% str_replace(pattern     = "Impuestos menos subvenciones sobre los productos",
                                                               replacement = "Taxes - subsidies"))) %>%
    tidyr::pivot_longer(cols     = -ID,
                        names_to = "year",
                        values_to = "value") %>% 
    dplyr::arrange(year) %>% 
    dplyr::mutate(ID = forcats::as_factor(ID)) %>% 
    dplyr::group_by(year) %>% 
    dplyr::mutate(pct_value  = value / sum(value),
                  label_text = stringr::str_glue('Sector: {ID}
                                                  Year: {year}
                                                  Value (Thousands of millions): {value %>% scales::dollar()}
                                                  % of GDP: {pct_value %>% scales::percent(accuracy = 0.01)}')) %>% 
    dplyr::ungroup()

# Plot
static_plot2 <- gdp_col_value_added %>% 
    ggplot2::ggplot(aes(y = pct_value, x = year, fill = ID)) +
    # Geoms
    ggplot2::geom_col(aes(fill = ID, text = label_text),
                      color = "black") + 
    # Scales
    scale_fill_manual(values = c("#2C3E50", "#E31A1C", "#18BC9C", "#CCBE93", 
                                 "#A6CEE3", "#1F78B4", "#B2DF8A", "#FB9A99", 
                                 "#FDBF6F", "#FF7F00", "#CAB2D6", "#6A3D9A",
                                 "#666600")) + 
    scale_y_continuous(labels = scales::percent_format()) +
    labs(x     = "Year",
         y     = "Percentage %",
         fill  = " ",
         title = "Taxes - subsidies & value added by sectors as % of GDP") +
    # Themes
    ggplot2::theme(panel.border      = element_rect(fill = NA, color = "black"),
                   plot.background   = element_rect(fill = "#f3fcfc"),
                   panel.background  = element_rect(fill = "#f3f7fc"),
                   legend.background = element_rect(fill = "#f3fcfc"),
                   plot.title        = element_text(face = "bold"),
                   axis.text.x       = element_text(angle = -90, vjust = 0.5),
                   axis.title        = element_text(face = "bold"),
                   legend.title      = element_text(face = "bold"),
                   axis.text         = element_text(face = "bold"))

    # Interactivity
    static_plot2 %>%
        plotly::ggplotly(tooltip = "text")

Bibliography

Blanchard, Olivier. 2017. Macroeconomics. 7th ed. Boston: Pearson.

Lequiller, François, and Derek Blades. 2014. Understanding National Accounts: Second Edition. OECD. https://doi.org/10.1787/9789264214637-en.


  1. International Standard Industrial Classification of All Economic Activities↩︎